package com.crm.controller;


//import com.github.pagehelper.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crm.common.annotation.Log;
import com.crm.common.enums.BusinessType;
import com.crm.common.result.PageResult;
import com.crm.domain.Notice;
import com.crm.service.NoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/system/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;
    @GetMapping("/pagelist/{status}")
    @Log(title = "通知管理", businessType = BusinessType.EXPORT)
    public PageResult test(@PathVariable String status,
                           @RequestParam(defaultValue = "1") int pageNum,
                           @RequestParam(defaultValue = "10") int pageSize) {
        log.info("查询通知列表，状态: {}, 第 {} 页，每页 {} 条", status, pageNum, pageSize);

        Page<Notice> page = noticeService.selectBylist(status, pageNum, pageSize);
        return new PageResult(page.getTotal(), page.getRecords());
    }


}
